<?php
class CartWS_TestController extends Ext_Controller_Action
{
    public function trackAction()
    {
    	$userId = 148;
    	$credential = '0xfQPFeNi69Q3Uq/DpsH5Jde946ssKHYchv+9RhAmNkK1ohZvGjvqLEvwbygYSwWsIkvbA7o/VTUx0bjy2AvPClO04uBQKlb/BxrpJD6z51ZJ0d7CJs73rh1zDtwVsb1oCNeHEpLaiSNXbyBfc42lKIuaOoCqtT1smIpK/cBglrxfJhBj/EP3UpZUNxjhZPW2Vn7ZVRR6aTrBYrGLl0XEQB2CqkYMbJ2';
    	echo $credential;
    	echo "<br/>";echo "<br/>";
    	echo $userId;
    	echo "<br/>";echo "<br/>";
    	echo "<br/>";
    	$trck = new CartWS_Service_Order();
    	$trck->trackOrder($userId, $credential, $_GET['orderId']);
    	exit;
    }

    public function formulaAction()
    {
        $formula = CartWS_Model_FormulaEngine_Engine::getInstance();
        $formula->processOrder( 824 );
        die( 'DONE' );
    }
    
    public function decodeAction()
    {
    
    	$json = '{"version":"1.0","organizationId":"1","orders":{"865":{"orderDate":"2009-09-21 13:08","shippingMethod":{"description":"Chile express","priority":"23"},"orderTotalAmount":"4796.89","orderShippingPrice":"0","orderDiscount":0,"properties":{"customer_name":"Miquel, Cesar","customer_email":"admin","shipToDetail":{"value":"{\"street_name\":\"Parana\",\"street_number\":\"759\",\"apt_floor\":\"3\"}","type":"streetDetail"},"billToDetail":{"value":"{\"street_name\":\"Parana\",\"street_number\":\"889\",\"apt_floor\":\"1\"}","type":"streetDetail"}},"customer":{"customerId":"1","customerName":"Miquel, Cesar","customerEmail":"admin","customerTel":"0111562773284"},"paymentMethod":{"paymentMethodId":"3","description":"Cobrado por cuenta corriente","ticket":false},"shipToAddress":{"dropPoint":1,"addressId":"390","addressLine1":"Parana 759 3","addressLine2":"","country":"Chile","state":"Sexta Region","county":"Rancagua","city":"Coltauco","neighborhood":""},"billToAddress":{"dropPoint":1,"addressId":"394","addressLine1":"Parana 889 1","addressLine2":"","country":"Chile","state":"Cuarta Region","county":"Coquimbo","city":"Coquimbo","neighborhood":""},"lines":{"1946":{"productId":109,"productDescription":"{\"title\":\"Dise\\u00f1o de Flores - Vaio TT 14\\\"\",\"authors\":\"\"}","productDetail":null,"productType":"design","orderedQuantity":"1","productSellingPrice":1190,"lineShippingPrice":"0","lineDiscount":0,"tax":"19","totalAmount":"1190"},"1947":{"productId":104,"productDescription":"{\"title\":\"Dise\\u00f1o Zebra\",\"authors\":\"\"}","productDetail":null,"productType":"design","orderedQuantity":"2","productSellingPrice":18.445,"lineShippingPrice":"0","lineDiscount":0,"tax":"19","totalAmount":"36.89"},"1948":{"productId":98,"productDescription":"{\"title\":\"Iphone 16GB Zebra\",\"authors\":\"\"}","productDetail":"Iphone con Fonde de cebra","productType":"design","orderedQuantity":"1","productSellingPrice":3558.1,"lineShippingPrice":"0","lineDiscount":0,"tax":"19","totalAmount":"3558.1"},"1952":{"productId":0,"productDescription":"{\"title\":\"Costo de envio ChileExpress\",\"authors\":\"\"}","productDetail":null,"productType":"ShippingCost","orderedQuantity":"1","productSellingPrice":11.9,"lineShippingPrice":"0","lineDiscount":0,"tax":"19","totalAmount":"11.9"}}}}}';
    	echo $json;
    	print_r( Zend_Json::decode($json) );exit;
    }
}